<%@ page import="com.ant.myagile.backlog.Issue" %>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<meta name="layout" content="main"/>
		<title>Create a new issue</title>
	</head>
	<body>
	<h1>LIST OF ISSUES</h1>
	<div style="margin:auto; width:90%; text-align: left">
			<span><a href="${createLink(controller:'Issue',action:'newIssue')}" ><img alt="setting" src="../images/skin/add-icon.png"> New Issue </a></span>		
			<span style="float: right">
				<g:jasperReport action="filterIssueReport" controller="Issue" format="PDF" jasper="ExportSCard.jrxml" name="Story Cards">
					<input type="hidden" name="h_status" id="h_status" value="None" />
				</g:jasperReport>
			</span>	
	</div>
	<div style="margin:auto; width:90%; text-align: left">
		Status : 
		<select id="s_filter" name="s_filter">
			<option value="None">No filter</option>
			<option value="Not started">Not started</option>
			<option value="InProgress">Progress</option>
			<option value="Blocked">Blocked</option>
			<option value="Verify">Verify</option>
			<option value="Done">Done</option>
			<option value="Void">Void</option>
		</select> 
	</div>
	<div>
	</div>
	<div style="clear:both"></div>
	<table cellspacing="0" border="1" class="table-customize">
		<thead>
			<tr style="background: orange;" align="center">
				<th>ID</th>
				<th>Type</th>
				<th>Subject</th>
				<th>Description</th>
				<th>Status</th>
				<th>Priority</th>
				<th>Assigned</th>
				<th>Remain</th>
				<th>Estimate</th>
				<th>User Story</th>
				<th>Sprint</th>
				<th>Delete</th>
				<th>Edit</th>
			</tr>
		</thead>
		<tbody id="ListValue">
			<g:each in="${issueList}" var="iss" status="i">			
			<tr>
				<td>${iss.id}</td>
				<td>${iss.type}</td>
				<td>${iss.subject}</td>
				<td>${iss.description}</td>
				<td>${iss.status}</td>
				<td>${iss.priority}</td>
				<td>${iss.assigned}</td>
				<td>${iss.remain}</td>
				<td>${iss.estimate}</td>
				<td>${iss.userStory}</td>
				<td>${iss.sprint}</td>
				<td>
					<form action="deleteIssue" controller="issue" style="margin:0">
					<input type="hidden" name="id" value="${iss.id}">
					<g:submitButton class="btn"  value="Delete" name="submit" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');"/>
					</form>
				</td>		
				<td>
					<a href="editIssue?id=${iss.id}" class="btn">Edit</a>
				</td>
			</tr>			
			</g:each>
		</tbody>
	</table>
		<script type="text/javascript">
		$(document).ready(function(){
			$('#s_filter').change(function() {
				var filter=$("#s_filter").val();
				$("#h_status").val(filter);
				$.ajax({
					url: '${g.createLink(controller: 'issue', action: 'filterIssue')}',
					dataType: 'text',
					data: {
						filter: filter
					},
					success: function(data){
						if(data)
							$("#ListValue").html(data);
						else
							$("#ListValue").html("No data to display");
					}
					
				});
			});
		});
	</script>
	</body>

</html>

